


window.onload = function (){
    showLoginInfo();

    findBySend();
}
function showLoginInfo(){
    axios.get("/user/getLoginUser",null).then(e=>{
        var info = e.data;
        if (info == null || info =='') {
            location.href="/login.html?loginError=noSend";
        }
    })
}
 function findBySend(){
  axios.get("/send/order/findBySend",null).then(e=>{
        var info = e.data;
        var str ="";
        for (var i=0;i<info.length;i++){
            var obj = info[i];
            str+=`<tr>
        <td>${obj.id}</td><td>${obj.accept}</td><td>${obj.phone}
        </td><td>${obj.price}</td><td><a href="javascript:updateStatus(${obj.id})">结账</a></td>
</tr>`
        }
        $("SDiv").innerHTML = str;
    })


}
function updateStatus(id){

    axios.get("/send/order/updateStatus",{
        params:{
            id:id,
            status:"已完结"
        }
    }).then(e=>{
        if (e.data =="ok"){
            location.href="/send/send.html";
        }
    })
}